<?php

	include("utils/Database.php");
	$database = new Database();
	
	$database->setUser('root');
	$database->setHost('localhost');
	$database->setDatabase('u903824408_quali');
	
	
	
	
	$cod = $_POST['id'];
	
	$xml = "<?xml version='1.0' encoding='UTF-8' ?>";
	$xml .="<cities>";
	
	if($database->connect()){
			$sql = $database->query("SELECT id, nome FROM cidade WHERE estado = $cod;");
			while($row = mysql_fetch_assoc($sql)){
				$xml .= "<city id='".$row['id']."'>".$row['nome']."</city>";			
						
			}
			$xml.="</cities>";
			
			header("Content-Type: text/xml");
			
			echo $xml;
			
		}
	else{
		echo "deu merda".mysql_error();
	}

?>